<!DOCTYPE html>

<html>
<head>
<meta charset="UTF-8">

<title>class AboutYou::SDK::Factory::DefaultModelFactory - RDoc Documentation</title>

<link href="../../../fonts.css" rel="stylesheet">
<link href="../../../rdoc.css" rel="stylesheet">

<script type="text/javascript">
  var rdoc_rel_prefix = "../../../";
</script>

<script src="../../../js/jquery.js"></script>
<script src="../../../js/navigation.js"></script>
<script src="../../../js/search_index.js"></script>
<script src="../../../js/search.js"></script>
<script src="../../../js/searcher.js"></script>
<script src="../../../js/darkfish.js"></script>


<body id="top" role="document" class="class">
<nav role="navigation">
  <div id="project-navigation">
    <div id="home-section" role="region" title="Quick navigation" class="nav-section">
  <h2>
    <a href="../../../index.html" rel="home">Home</a>
  </h2>

  <div id="table-of-contents-navigation">
    <a href="../../../table_of_contents.html#pages">Pages</a>
    <a href="../../../table_of_contents.html#classes">Classes</a>
    <a href="../../../table_of_contents.html#methods">Methods</a>
  </div>
</div>

    <div id="search-section" role="search" class="project-section initially-hidden">
  <form action="#" method="get" accept-charset="utf-8">
    <div id="search-field-wrapper">
      <input id="search-field" role="combobox" aria-label="Search"
             aria-autocomplete="list" aria-controls="search-results"
             type="text" name="search" placeholder="Search" spellcheck="false"
             title="Type to search, Up and Down to navigate, Enter to load">
    </div>

    <ul id="search-results" aria-label="Search Results"
        aria-busy="false" aria-expanded="false"
        aria-atomic="false" class="initially-hidden"></ul>
  </form>
</div>

  </div>

  

  <div id="class-metadata">
    
    <div id="parent-class-section" class="nav-section">
  <h3>Parent</h3>

  
  <p class="link">Object
  
</div>

    
    
    <!-- Method Quickref -->
<div id="method-list-section" class="nav-section">
  <h3>Methods</h3>

  <ul class="link-list" role="directory">
    
    <li ><a href="#method-c-new">::new</a>
    
    <li ><a href="#method-i-base_image_url-3D">#base_image_url=</a>
    
    <li ><a href="#method-i-create_app">#create_app</a>
    
    <li ><a href="#method-i-create_autocomplete">#create_autocomplete</a>
    
    <li ><a href="#method-i-create_basket">#create_basket</a>
    
    <li ><a href="#method-i-create_basket_item">#create_basket_item</a>
    
    <li ><a href="#method-i-create_basket_set">#create_basket_set</a>
    
    <li ><a href="#method-i-create_basket_set_item">#create_basket_set_item</a>
    
    <li ><a href="#method-i-create_brand">#create_brand</a>
    
    <li ><a href="#method-i-create_categories_facets">#create_categories_facets</a>
    
    <li ><a href="#method-i-create_categories_result">#create_categories_result</a>
    
    <li ><a href="#method-i-create_category">#create_category</a>
    
    <li ><a href="#method-i-create_category_tree">#create_category_tree</a>
    
    <li ><a href="#method-i-create_child_apps">#create_child_apps</a>
    
    <li ><a href="#method-i-create_facet">#create_facet</a>
    
    <li ><a href="#method-i-create_facet_list">#create_facet_list</a>
    
    <li ><a href="#method-i-create_facet_types">#create_facet_types</a>
    
    <li ><a href="#method-i-create_facets_counts">#create_facets_counts</a>
    
    <li ><a href="#method-i-create_facets_list">#create_facets_list</a>
    
    <li ><a href="#method-i-create_image">#create_image</a>
    
    <li ><a href="#method-i-create_order">#create_order</a>
    
    <li ><a href="#method-i-create_price_ranges">#create_price_ranges</a>
    
    <li ><a href="#method-i-create_product">#create_product</a>
    
    <li ><a href="#method-i-create_product_search_result">#create_product_search_result</a>
    
    <li ><a href="#method-i-create_products_ean_result">#create_products_ean_result</a>
    
    <li ><a href="#method-i-create_products_result">#create_products_result</a>
    
    <li ><a href="#method-i-create_sale_facet">#create_sale_facet</a>
    
    <li ><a href="#method-i-create_single_product">#create_single_product</a>
    
    <li ><a href="#method-i-create_spell_correction">#create_spell_correction</a>
    
    <li ><a href="#method-i-create_suggest">#create_suggest</a>
    
    <li ><a href="#method-i-create_variant">#create_variant</a>
    
    <li ><a href="#method-i-create_variants_result">#create_variants_result</a>
    
    <li ><a href="#method-i-initialize_category_manager">#initialize_category_manager</a>
    
    <li ><a href="#method-i-initialize_managers">#initialize_managers</a>
    
    <li ><a href="#method-i-initiate_order">#initiate_order</a>
    
    <li ><a href="#method-i-pre_handle_error">#pre_handle_error</a>
    
    <li ><a href="#method-i-term_facets">#term_facets</a>
    
    <li ><a href="#method-i-update_facet_manager">#update_facet_manager</a>
    
  </ul>
</div>

  </div>
</nav>

<main role="main" aria-labelledby="class-AboutYou::SDK::Factory::DefaultModelFactory">
  <h1 id="class-AboutYou::SDK::Factory::DefaultModelFactory" class="class">
    class AboutYou::SDK::Factory::DefaultModelFactory
  </h1>

  <section class="description">
    
<p>This class creates model objects from a given api response the methods will
get called automatically from the query so no need to call them by hand</p>
<dl class="rdoc-list note-list"><dt>author
<dd>
<p>Collins GmbH &amp; Co KG</p>
</dd></dl>

  </section>

  
  
  
  <section id="5Buntitled-5D" class="documentation-section">
    

    

    

    
    <section class="attribute-method-details" class="method-section">
      <header>
        <h3>Attributes</h3>
      </header>

      
      <div id="attribute-i-category_manager" class="method-detail">
        <div class="method-heading attribute-method-heading">
          <span class="method-name">category_manager</span><span
            class="attribute-access-type">[RW]</span>
        </div>

        <div class="method-description">
        
        <p>the category manager responsible for managing the categories</p>
        
        </div>
      </div>
      
      <div id="attribute-i-facet_manager" class="method-detail">
        <div class="method-heading attribute-method-heading">
          <span class="method-name">facet_manager</span><span
            class="attribute-access-type">[RW]</span>
        </div>

        <div class="method-description">
        
        <p>the facet manager responsible for managing the facets</p>
        
        </div>
      </div>
      
      <div id="attribute-i-shop_api" class="method-detail">
        <div class="method-heading attribute-method-heading">
          <span class="method-name">shop_api</span><span
            class="attribute-access-type">[RW]</span>
        </div>

        <div class="method-description">
        
        <p>The client which performs the api calls</p>
        
        </div>
      </div>
      
    </section>
    

    
     <section id="public-class-5Buntitled-5D-method-details" class="method-section">
       <header>
         <h3>Public Class Methods</h3>
       </header>

    
      <div id="method-c-new" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">new</span><span
            class="method-args">(shop_api = nil)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>Constructor for <a
href="DefaultModelFactory.html">AboutYou::SDK::Factory::DefaultModelFactory</a></p>
<ul><li>
<p><strong>Args</strong>    :</p>
<ul><li>
<p><code>shop_api</code> -&gt; the client which should perform the api calls</p>
</li><li>
<p><code>category_manager</code> -&gt; the category manager responsible for
managing the categories</p>
</li><li>
<p><code>facet_manager</code> -&gt; the facet manager responsible for managing
the facets</p>
</li></ul>
</li><li>
<p><strong>Returns</strong> :</p>
<ul><li>
<p>an instance of <a
href="DefaultModelFactory.html">AboutYou::SDK::Factory::DefaultModelFactory</a></p>
</li></ul>
</li></ul>
          
          

          
          <div class="method-source-code" id="new-source">
            <pre><span class="ruby-comment"># File lib/AboutYou/Factory/default_model_factory.rb, line 33</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">shop_api</span> = <span class="ruby-keyword">nil</span>)
  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">shop_api</span> = <span class="ruby-identifier">shop_api</span>
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
    </section>
  
     <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
       <header>
         <h3>Public Instance Methods</h3>
       </header>

    
      <div id="method-i-base_image_url-3D" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">base_image_url=</span><span
            class="method-args">(base_url)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>sets the baseimage url for the image model</p>
<ul><li>
<p><strong>Args</strong>    :</p>
<ul><li>
<p><code>base_url</code> -&gt; the url which should be used by the image model</p>
</li></ul>
</li></ul>
          
          

          
          <div class="method-source-code" id="base_image_url-3D-source">
            <pre><span class="ruby-comment"># File lib/AboutYou/Factory/default_model_factory.rb, line 56</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">base_image_url=</span>(<span class="ruby-identifier">base_url</span>)
  <span class="ruby-constant">AboutYou</span><span class="ruby-operator">::</span><span class="ruby-constant">SDK</span><span class="ruby-operator">::</span><span class="ruby-constant">Model</span><span class="ruby-operator">::</span><span class="ruby-constant">Image</span>.<span class="ruby-identifier">base_url</span> = <span class="ruby-identifier">base_url</span>
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-create_app" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">create_app</span><span
            class="method-args">(json_object)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>creates an app model</p>
<ul><li>
<p><strong>Args</strong>    :</p>
<ul><li>
<p><code>json_object</code> -&gt; the api response in json format</p>
</li></ul>
</li><li>
<p><strong>Returns</strong> :</p>
<ul><li>
<p>an instance of <a href="../Model/App.html">AboutYou::SDK::Model::App</a></p>
</li></ul>
</li></ul>
          
          

          
          <div class="method-source-code" id="create_app-source">
            <pre><span class="ruby-comment"># File lib/AboutYou/Factory/default_model_factory.rb, line 552</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">create_app</span>(<span class="ruby-identifier">json_object</span>)
  <span class="ruby-constant">AboutYou</span><span class="ruby-operator">::</span><span class="ruby-constant">SDK</span><span class="ruby-operator">::</span><span class="ruby-constant">Model</span><span class="ruby-operator">::</span><span class="ruby-constant">App</span>.<span class="ruby-identifier">create_from_json</span>(<span class="ruby-identifier">json_object</span>)
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-create_autocomplete" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">create_autocomplete</span><span
            class="method-args">(json_object, _query)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>creates an autocomplete model</p>
<ul><li>
<p><strong>Args</strong>    :</p>
<ul><li>
<p><code>json_object</code> -&gt; the api response in json format</p>
</li><li>
<p><code>query</code> -&gt; the query sent to the api</p>
</li></ul>
</li><li>
<p><strong>Returns</strong> :</p>
<ul><li>
<p>an instance of <a
href="../Model/Autocomplete.html">AboutYou::SDK::Model::Autocomplete</a></p>
</li></ul>
</li></ul>
          
          

          
          <div class="method-source-code" id="create_autocomplete-source">
            <pre><span class="ruby-comment"># File lib/AboutYou/Factory/default_model_factory.rb, line 70</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">create_autocomplete</span>(<span class="ruby-identifier">json_object</span>, <span class="ruby-identifier">_query</span>)
  <span class="ruby-constant">AboutYou</span><span class="ruby-operator">::</span><span class="ruby-constant">SDK</span><span class="ruby-operator">::</span><span class="ruby-constant">Model</span><span class="ruby-operator">::</span><span class="ruby-constant">Autocomplete</span>.<span class="ruby-identifier">create_from_json</span>(<span class="ruby-identifier">json_object</span>, <span class="ruby-keyword">self</span>)
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-create_basket" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">create_basket</span><span
            class="method-args">(json_object, _query)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>creates a basket model</p>
<ul><li>
<p><strong>Args</strong>    :</p>
<ul><li>
<p><code>json_object</code> -&gt; the api response in json format</p>
</li><li>
<p><code>query</code> -&gt; the query sent to the api</p>
</li></ul>
</li><li>
<p><strong>Returns</strong> :</p>
<ul><li>
<p>an instance of <a
href="../Model/Basket.html">AboutYou::SDK::Model::Basket</a></p>
</li></ul>
</li></ul>
          
          

          
          <div class="method-source-code" id="create_basket-source">
            <pre><span class="ruby-comment"># File lib/AboutYou/Factory/default_model_factory.rb, line 84</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">create_basket</span>(<span class="ruby-identifier">json_object</span>, <span class="ruby-identifier">_query</span>)
  <span class="ruby-constant">AboutYou</span><span class="ruby-operator">::</span><span class="ruby-constant">SDK</span><span class="ruby-operator">::</span><span class="ruby-constant">Model</span><span class="ruby-operator">::</span><span class="ruby-constant">Basket</span>.<span class="ruby-identifier">create_from_json</span>(<span class="ruby-identifier">json_object</span>, <span class="ruby-keyword">self</span>)
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-create_basket_item" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">create_basket_item</span><span
            class="method-args">(json_object, products)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>creates a basket item model</p>
<ul><li>
<p><strong>Args</strong>    :</p>
<ul><li>
<p><code>json_object</code> -&gt; the api response in json format</p>
</li><li>
<p><code>products</code> -&gt; the product models for which items should be
created</p>
</li></ul>
</li><li>
<p><strong>Returns</strong> :</p>
<ul><li>
<p>an instance of <a
href="../Model/BasketItem.html">AboutYou::SDK::Model::BasketItem</a></p>
</li></ul>
</li></ul>
          
          

          
          <div class="method-source-code" id="create_basket_item-source">
            <pre><span class="ruby-comment"># File lib/AboutYou/Factory/default_model_factory.rb, line 98</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">create_basket_item</span>(<span class="ruby-identifier">json_object</span>, <span class="ruby-identifier">products</span>)
  <span class="ruby-constant">AboutYou</span><span class="ruby-operator">::</span><span class="ruby-constant">SDK</span><span class="ruby-operator">::</span><span class="ruby-constant">Model</span><span class="ruby-operator">::</span><span class="ruby-constant">Basket</span><span class="ruby-operator">::</span><span class="ruby-constant">BasketItem</span>.<span class="ruby-identifier">create_from_json</span>(
    <span class="ruby-identifier">json_object</span>,
    <span class="ruby-identifier">products</span>
  )
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-create_basket_set" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">create_basket_set</span><span
            class="method-args">(json_object, products)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>creates a basket set model</p>
<ul><li>
<p><strong>Args</strong>    :</p>
<ul><li>
<p><code>json_object</code> -&gt; the api response in json format</p>
</li><li>
<p><code>products</code> -&gt; the product models for which items should be
created</p>
</li></ul>
</li><li>
<p><strong>Returns</strong> :</p>
<ul><li>
<p>an instance of <a
href="../Model/BasketSet.html">AboutYou::SDK::Model::BasketSet</a></p>
</li></ul>
</li></ul>
          
          

          
          <div class="method-source-code" id="create_basket_set-source">
            <pre><span class="ruby-comment"># File lib/AboutYou/Factory/default_model_factory.rb, line 115</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">create_basket_set</span>(<span class="ruby-identifier">json_object</span>, <span class="ruby-identifier">products</span>)
  <span class="ruby-constant">AboutYou</span><span class="ruby-operator">::</span><span class="ruby-constant">SDK</span><span class="ruby-operator">::</span><span class="ruby-constant">Model</span><span class="ruby-operator">::</span><span class="ruby-constant">BasketSet</span>.<span class="ruby-identifier">create_from_json</span>(
    <span class="ruby-identifier">json_object</span>,
    <span class="ruby-keyword">self</span>,
    <span class="ruby-identifier">products</span>
  )
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-create_basket_set_item" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">create_basket_set_item</span><span
            class="method-args">(json_object, products)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>creates a basket setitem model</p>
<ul><li>
<p><strong>Args</strong>    :</p>
<ul><li>
<p><code>json_object</code> -&gt; the api response in json format</p>
</li><li>
<p><code>products</code> -&gt; the product models for which items should be
created</p>
</li></ul>
</li><li>
<p><strong>Returns</strong> :</p>
<ul><li>
<p>an instance of <a
href="../Model/BasketSetItem.html">AboutYou::SDK::Model::BasketSetItem</a></p>
</li></ul>
</li></ul>
          
          

          
          <div class="method-source-code" id="create_basket_set_item-source">
            <pre><span class="ruby-comment"># File lib/AboutYou/Factory/default_model_factory.rb, line 133</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">create_basket_set_item</span>(<span class="ruby-identifier">json_object</span>, <span class="ruby-identifier">products</span>)
  <span class="ruby-constant">AboutYou</span><span class="ruby-operator">::</span><span class="ruby-constant">SDK</span><span class="ruby-operator">::</span><span class="ruby-constant">Model</span><span class="ruby-operator">::</span><span class="ruby-constant">BasketSetItem</span>.<span class="ruby-identifier">create_from_json</span>(
    <span class="ruby-identifier">json_object</span>,
    <span class="ruby-identifier">products</span>
  )
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-create_brand" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">create_brand</span><span
            class="method-args">(json_object)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>this method creates the brand model</p>
<ul><li>
<p><strong>Args</strong>    :</p>
<ul><li>
<p><code>json_object</code> -&gt; the response from the api in json format</p>
</li></ul>
</li><li>
<p><strong>Returns</strong> :</p>
<ul><li>
<p>an instance of <a
href="../Model/Brand.html">AboutYou::SDK::Model::Brand</a></p>
</li></ul>
</li></ul>
          
          

          
          <div class="method-source-code" id="create_brand-source">
            <pre><span class="ruby-comment"># File lib/AboutYou/Factory/default_model_factory.rb, line 659</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">create_brand</span>(<span class="ruby-identifier">json_object</span>)
  <span class="ruby-constant">AboutYou</span><span class="ruby-operator">::</span><span class="ruby-constant">SDK</span><span class="ruby-operator">::</span><span class="ruby-constant">Model</span><span class="ruby-operator">::</span><span class="ruby-constant">Brand</span>.<span class="ruby-identifier">create_from_json</span>(<span class="ruby-identifier">json_object</span>)
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-create_categories_facets" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">create_categories_facets</span><span
            class="method-args">(json_array)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>this method creates the facets for given categories</p>
<ul><li>
<p><strong>Args</strong>    :</p>
<ul><li>
<p><code>jsonArray</code> -&gt; an Array containing the Api response</p>
</li></ul>
</li><li>
<p><strong>Returns</strong> :</p>
<ul><li>
<p>a Hash containing pairs of category_id =&gt; category</p>
</li></ul>
</li></ul>
          
          

          
          <div class="method-source-code" id="create_categories_facets-source">
            <pre><span class="ruby-comment"># File lib/AboutYou/Factory/default_model_factory.rb, line 634</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">create_categories_facets</span>(<span class="ruby-identifier">json_array</span>)
  <span class="ruby-identifier">category_manager</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">category_manager</span>

  <span class="ruby-identifier">flatten_categories</span> = {}
  <span class="ruby-identifier">json_array</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">item</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">id</span> = <span class="ruby-identifier">item</span>[<span class="ruby-string">'term'</span>]
    <span class="ruby-identifier">category</span> = <span class="ruby-identifier">category_manager</span>.<span class="ruby-identifier">category</span>(<span class="ruby-identifier">id</span>)
    <span class="ruby-keyword">next</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">category</span>

    <span class="ruby-identifier">category</span>.<span class="ruby-identifier">product_count</span> = <span class="ruby-identifier">item</span>[<span class="ruby-string">'count'</span>]
    <span class="ruby-identifier">flatten_categories</span>[<span class="ruby-identifier">id</span>] = <span class="ruby-identifier">category</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">flatten_categories</span>
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-create_categories_result" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">create_categories_result</span><span
            class="method-args">(json_object, query)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>creates a categories result model</p>
<ul><li>
<p><strong>Args</strong>    :</p>
<ul><li>
<p><code>json_object</code> -&gt; the api response in json format</p>
</li><li>
<p><code>query</code> -&gt; the query sent to the api</p>
</li></ul>
</li><li>
<p><strong>Returns</strong> :</p>
<ul><li>
<p>an instance of <a
href="../Model/CategoriesResult.html">AboutYou::SDK::Model::CategoriesResult</a></p>
</li></ul>
</li></ul>
          
          

          
          <div class="method-source-code" id="create_categories_result-source">
            <pre><span class="ruby-comment"># File lib/AboutYou/Factory/default_model_factory.rb, line 452</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">create_categories_result</span>(<span class="ruby-identifier">json_object</span>, <span class="ruby-identifier">query</span>)
  <span class="ruby-constant">AboutYou</span><span class="ruby-operator">::</span><span class="ruby-constant">SDK</span><span class="ruby-operator">::</span><span class="ruby-constant">Model</span><span class="ruby-operator">::</span><span class="ruby-constant">CategoriesResult</span>.<span class="ruby-identifier">create_from_json</span>(
    <span class="ruby-identifier">json_object</span>,
    <span class="ruby-identifier">query</span>[<span class="ruby-string">'ids'</span>],
    <span class="ruby-keyword">self</span>
  )
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-create_category" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">create_category</span><span
            class="method-args">(json_object)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>creates a category model</p>
<ul><li>
<p><strong>Args</strong>    :</p>
<ul><li>
<p><code>json_object</code> -&gt; the api response in json format</p>
</li></ul>
</li><li>
<p><strong>Returns</strong> :</p>
<ul><li>
<p>an instance of <a
href="../Model/Category.html">AboutYou::SDK::Model::Category</a></p>
</li></ul>
</li></ul>
          
          

          
          <div class="method-source-code" id="create_category-source">
            <pre><span class="ruby-comment"># File lib/AboutYou/Factory/default_model_factory.rb, line 149</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">create_category</span>(<span class="ruby-identifier">json_object</span>)
  <span class="ruby-constant">AboutYou</span><span class="ruby-operator">::</span><span class="ruby-constant">SDK</span><span class="ruby-operator">::</span><span class="ruby-constant">Model</span><span class="ruby-operator">::</span><span class="ruby-constant">Category</span>.<span class="ruby-identifier">create_from_json</span>(
    <span class="ruby-identifier">json_object</span>,
    <span class="ruby-identifier">category_manager</span>
  )
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-create_category_tree" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">create_category_tree</span><span
            class="method-args">(json_array, _query)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>creates a category tree model</p>
<ul><li>
<p><strong>Args</strong>    :</p>
<ul><li>
<p><code>jsonArray</code> -&gt; an Array containing the api response</p>
</li><li>
<p><code>_query</code> -&gt; the _query sent to the api</p>
</li></ul>
</li><li>
<p><strong>Returns</strong> :</p>
<ul><li>
<p>an instance of <a
href="../Model/CategoryTree.html">AboutYou::SDK::Model::CategoryTree</a></p>
</li></ul>
</li></ul>
          
          

          
          <div class="method-source-code" id="create_category_tree-source">
            <pre><span class="ruby-comment"># File lib/AboutYou/Factory/default_model_factory.rb, line 166</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">create_category_tree</span>(<span class="ruby-identifier">json_array</span>, <span class="ruby-identifier">_query</span>)
  <span class="ruby-identifier">initialize_category_manager</span>(<span class="ruby-identifier">json_array</span>)
  <span class="ruby-constant">AboutYou</span><span class="ruby-operator">::</span><span class="ruby-constant">SDK</span><span class="ruby-operator">::</span><span class="ruby-constant">Model</span><span class="ruby-operator">::</span><span class="ruby-constant">CategoryTree</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">category_manager</span>)
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-create_child_apps" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">create_child_apps</span><span
            class="method-args">(json_object, _query)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>creates a Has containing one or multiple pairs of app_id =&gt; instance of
<a href="../Model/App.html">AboutYou::SDK::Model::App</a></p>
<ul><li>
<p><strong>Args</strong>    :</p>
<ul><li>
<p><code>json_object</code> -&gt; the api response in json format</p>
</li><li>
<p><code>_query</code> -&gt; the _query sent to the api</p>
</li></ul>
</li><li>
<p><strong>Returns</strong> :</p>
<ul><li>
<p>a Hash containing pairs of app_id =&gt; instance of <a
href="../Model/App.html">AboutYou::SDK::Model::App</a></p>
</li></ul>
</li></ul>
          
          

          
          <div class="method-source-code" id="create_child_apps-source">
            <pre><span class="ruby-comment"># File lib/AboutYou/Factory/default_model_factory.rb, line 533</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">create_child_apps</span>(<span class="ruby-identifier">json_object</span>, <span class="ruby-identifier">_query</span>)
  <span class="ruby-identifier">apps</span> = {}
  <span class="ruby-identifier">json_object</span>[<span class="ruby-string">'child_apps'</span>].<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">json_app</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">app</span> = <span class="ruby-identifier">create_app</span>(<span class="ruby-identifier">json_app</span>)
    <span class="ruby-identifier">apps</span>[<span class="ruby-identifier">app</span>.<span class="ruby-identifier">id</span>] = <span class="ruby-identifier">app</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">apps</span>
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-create_facet" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">create_facet</span><span
            class="method-args">(json_object)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>creates a facet model</p>
<ul><li>
<p><strong>Args</strong>    :</p>
<ul><li>
<p><code>json_object</code> -&gt; the api response in json format</p>
</li></ul>
</li><li>
<p><strong>Returns</strong> :</p>
<ul><li>
<p>an instance of <a
href="../Model/Facet.html">AboutYou::SDK::Model::Facet</a></p>
</li></ul>
</li></ul>
          
          

          
          <div class="method-source-code" id="create_facet-source">
            <pre><span class="ruby-comment"># File lib/AboutYou/Factory/default_model_factory.rb, line 180</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">create_facet</span>(<span class="ruby-identifier">json_object</span>)
  <span class="ruby-constant">AboutYou</span><span class="ruby-operator">::</span><span class="ruby-constant">SDK</span><span class="ruby-operator">::</span><span class="ruby-constant">Model</span><span class="ruby-operator">::</span><span class="ruby-constant">Facet</span>.<span class="ruby-identifier">create_from_json</span>(<span class="ruby-identifier">json_object</span>)
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-create_facet_list" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">create_facet_list</span><span
            class="method-args">(json_array, _query)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>creates a Hash containing one or multiple pairs of facetKey =&gt; <a
href="../Model/Facet.html">AboutYou::SDK::Model::Facet</a></p>
<ul><li>
<p><strong>Args</strong>    :</p>
<ul><li>
<p><code>jsonArray</code> -&gt; an Array containing the api response</p>
</li></ul>
</li><li>
<p><strong>Returns</strong> :</p>
<ul><li>
<p>a Hash containing pairs of facetKey =&gt; <a
href="../Model/Facet.html">AboutYou::SDK::Model::Facet</a></p>
</li></ul>
</li></ul>
          
          

          
          <div class="method-source-code" id="create_facet_list-source">
            <pre><span class="ruby-comment"># File lib/AboutYou/Factory/default_model_factory.rb, line 194</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">create_facet_list</span>(<span class="ruby-identifier">json_array</span>, <span class="ruby-identifier">_query</span>)
  <span class="ruby-identifier">facets</span> = {}
  <span class="ruby-identifier">json_array</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">json_facet</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">facet</span> = <span class="ruby-identifier">create_facet</span>(<span class="ruby-identifier">json_facet</span>)
    <span class="ruby-identifier">key</span> = <span class="ruby-identifier">facet</span>.<span class="ruby-identifier">unique_key</span>
    <span class="ruby-identifier">facets</span>[<span class="ruby-identifier">key</span>] = <span class="ruby-identifier">facet</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">facets</span>
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-create_facet_types" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">create_facet_types</span><span
            class="method-args">(json_array, _query)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>creates an Array containing all facet types available</p>
<ul><li>
<p><strong>Args</strong>    :</p>
<ul><li>
<p><code>jsonArray</code> -&gt; an Array containing the api response</p>
</li><li>
<p><code>_query</code> -&gt; the _query sent to the api</p>
</li></ul>
</li><li>
<p><strong>Returns</strong> :</p>
<ul><li>
<p>an Array containing all facet types available</p>
</li></ul>
</li></ul>
          
          

          
          <div class="method-source-code" id="create_facet_types-source">
            <pre><span class="ruby-comment"># File lib/AboutYou/Factory/default_model_factory.rb, line 290</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">create_facet_types</span>(<span class="ruby-identifier">json_array</span>, <span class="ruby-identifier">_query</span>)
  <span class="ruby-identifier">json_array</span>
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-create_facets_counts" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">create_facets_counts</span><span
            class="method-args">(json_object)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>creates a Hash containing one or multiple pairs of group_id =&gt; instance
of <a
href="../Model/FacetCounts.html">AboutYou::SDK::Model::FacetCounts</a></p>
<ul><li>
<p><strong>Args</strong>    :</p>
<ul><li>
<p><code>json_object</code> -&gt; the api response in json format</p>
</li></ul>
</li><li>
<p><strong>Returns</strong> :</p>
<ul><li>
<p>a Hash containing pairs of group_id =&gt; instance of <a
href="../Model/FacetCounts.html">AboutYou::SDK::Model::FacetCounts</a></p>
</li></ul>
</li></ul>
          
          

          
          <div class="method-source-code" id="create_facets_counts-source">
            <pre><span class="ruby-comment"># File lib/AboutYou/Factory/default_model_factory.rb, line 230</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">create_facets_counts</span>(<span class="ruby-identifier">json_object</span>)
  <span class="ruby-identifier">facets_counts</span> = {}

  <span class="ruby-identifier">json_object</span>[<span class="ruby-string">'facets'</span>].<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">group_id</span>, <span class="ruby-identifier">json_result_facet</span><span class="ruby-operator">|</span>
    <span class="ruby-keyword">next</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">group_id</span>[<span class="ruby-regexp">/\d/</span>]

    <span class="ruby-identifier">facet_counts</span> = <span class="ruby-identifier">term_facets</span>(
      <span class="ruby-identifier">group_id</span>,
      <span class="ruby-identifier">json_result_facet</span>[<span class="ruby-string">'terms'</span>]
    )
    <span class="ruby-identifier">facets_counts</span>[<span class="ruby-identifier">group_id</span>] =
      <span class="ruby-constant">AboutYou</span><span class="ruby-operator">::</span><span class="ruby-constant">SDK</span><span class="ruby-operator">::</span><span class="ruby-constant">Model</span><span class="ruby-operator">::</span><span class="ruby-constant">FacetCounts</span>.<span class="ruby-identifier">create_from_json</span>(
        <span class="ruby-identifier">group_id</span>,
        <span class="ruby-identifier">json_result_facet</span>,
        <span class="ruby-identifier">facet_counts</span>
      )
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">facets_counts</span>
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-create_facets_list" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">create_facets_list</span><span
            class="method-args">(json_object, query = nil)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>creates a Hash containing one or multiple pairs of facetKey =&gt; <a
href="../Model/Facet.html">AboutYou::SDK::Model::Facet</a></p>
<ul><li>
<p><strong>Args</strong>    :</p>
<ul><li>
<p><code>json_object</code> -&gt; the api response in json format</p>
</li><li>
<p><code>query</code> -&gt; the query sent to the api</p>
</li></ul>
</li><li>
<p><strong>Returns</strong> :</p>
<ul><li>
<p>a Hash containing pairs of facetKey =&gt; <a
href="../Model/Facet.html">AboutYou::SDK::Model::Facet</a></p>
</li></ul>
</li></ul>
          
          

          
          <div class="method-source-code" id="create_facets_list-source">
            <pre><span class="ruby-comment"># File lib/AboutYou/Factory/default_model_factory.rb, line 216</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">create_facets_list</span>(<span class="ruby-identifier">json_object</span>, <span class="ruby-identifier">query</span> = <span class="ruby-keyword">nil</span>)
  <span class="ruby-identifier">create_facet_list</span>(<span class="ruby-identifier">json_object</span>[<span class="ruby-string">'facet'</span>], <span class="ruby-identifier">query</span>)
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-create_image" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">create_image</span><span
            class="method-args">(json_object)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>creates an image model</p>
<ul><li>
<p><strong>Args</strong>    :</p>
<ul><li>
<p><code>json_object</code> -&gt; the api response in json format</p>
</li></ul>
</li><li>
<p><strong>Returns</strong> :</p>
<ul><li>
<p>an instance of <a
href="../Model/Image.html">AboutYou::SDK::Model::Image</a></p>
</li></ul>
</li></ul>
          
          

          
          <div class="method-source-code" id="create_image-source">
            <pre><span class="ruby-comment"># File lib/AboutYou/Factory/default_model_factory.rb, line 303</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">create_image</span>(<span class="ruby-identifier">json_object</span>)
  <span class="ruby-constant">AboutYou</span><span class="ruby-operator">::</span><span class="ruby-constant">SDK</span><span class="ruby-operator">::</span><span class="ruby-constant">Model</span><span class="ruby-operator">::</span><span class="ruby-constant">Image</span>.<span class="ruby-identifier">create_from_json</span>(<span class="ruby-identifier">json_object</span>)
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-create_order" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">create_order</span><span
            class="method-args">(json_object, _query)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>creates an order model</p>
<ul><li>
<p><strong>Args</strong>    :</p>
<ul><li>
<p><code>json_object</code> -&gt; the api response in json format</p>
</li><li>
<p><code>_query</code> -&gt; the _query sent to the api</p>
</li></ul>
</li><li>
<p><strong>Returns</strong> :</p>
<ul><li>
<p>an instance of <a
href="../Model/Order.html">AboutYou::SDK::Model::Order</a></p>
</li></ul>
</li></ul>
          
          

          
          <div class="method-source-code" id="create_order-source">
            <pre><span class="ruby-comment"># File lib/AboutYou/Factory/default_model_factory.rb, line 502</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">create_order</span>(<span class="ruby-identifier">json_object</span>, <span class="ruby-identifier">_query</span>)
  <span class="ruby-identifier">basket</span> = <span class="ruby-identifier">create_basket</span>(<span class="ruby-identifier">json_object</span>[<span class="ruby-string">'basket'</span>])

  <span class="ruby-constant">AboutYou</span><span class="ruby-operator">::</span><span class="ruby-constant">SDK</span><span class="ruby-operator">::</span><span class="ruby-constant">Model</span><span class="ruby-operator">::</span><span class="ruby-constant">Order</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">json_object</span>[<span class="ruby-string">'order_id'</span>], <span class="ruby-identifier">basket</span>)
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-create_price_ranges" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">create_price_ranges</span><span
            class="method-args">(json_object)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>this method creates a price range model</p>
<ul><li>
<p><strong>Args</strong>    :</p>
<ul><li>
<p><code>json_object</code> -&gt; the api response in json format</p>
</li></ul>
</li><li>
<p><strong>Returns</strong> :</p>
<ul><li>
<p>an Array containing instances of <a
href="../Model/PriceRange.html">AboutYou::SDK::Model::PriceRange</a></p>
</li></ul>
</li></ul>
          
          

          
          <div class="method-source-code" id="create_price_ranges-source">
            <pre><span class="ruby-comment"># File lib/AboutYou/Factory/default_model_factory.rb, line 599</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">create_price_ranges</span>(<span class="ruby-identifier">json_object</span>)
  <span class="ruby-identifier">price_ranges</span> = []
  <span class="ruby-identifier">json_object</span>[<span class="ruby-string">'ranges'</span>].<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">range</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">price_ranges</span>.<span class="ruby-identifier">push</span>(
      <span class="ruby-constant">AboutYou</span><span class="ruby-operator">::</span><span class="ruby-constant">SDK</span><span class="ruby-operator">::</span><span class="ruby-constant">Model</span><span class="ruby-operator">::</span><span class="ruby-constant">PriceRange</span>.<span class="ruby-identifier">create_from_json</span>(
        <span class="ruby-identifier">range</span>
      )
    )
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">price_ranges</span>
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-create_product" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">create_product</span><span
            class="method-args">(json_object)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>creates a product model</p>
<ul><li>
<p><strong>Args</strong>    :</p>
<ul><li>
<p><code>json_object</code> -&gt; the api response in json format</p>
</li></ul>
</li><li>
<p><strong>Returns</strong> :</p>
<ul><li>
<p>an instance of <a
href="../Model/Product.html">AboutYou::SDK::Model::Product</a></p>
</li></ul>
</li></ul>
          
          

          
          <div class="method-source-code" id="create_product-source">
            <pre><span class="ruby-comment"># File lib/AboutYou/Factory/default_model_factory.rb, line 316</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">create_product</span>(<span class="ruby-identifier">json_object</span>)
  <span class="ruby-constant">AboutYou</span><span class="ruby-operator">::</span><span class="ruby-constant">SDK</span><span class="ruby-operator">::</span><span class="ruby-constant">Model</span><span class="ruby-operator">::</span><span class="ruby-constant">Product</span>.<span class="ruby-identifier">create_from_json</span>(
    <span class="ruby-identifier">json_object</span>,
    <span class="ruby-keyword">self</span>,
    <span class="ruby-identifier">shop_api</span>.<span class="ruby-identifier">app_id</span>
  )
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-create_product_search_result" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">create_product_search_result</span><span
            class="method-args">(json_object, _query)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>creates a product searchresult model</p>
<ul><li>
<p><strong>Args</strong>    :</p>
<ul><li>
<p><code>json_object</code> -&gt; the api response in json format</p>
</li><li>
<p><code>_query</code> -&gt; the _query sent to the api</p>
</li></ul>
</li><li>
<p><strong>Returns</strong> :</p>
<ul><li>
<p>an instance of <a
href="../Model/ProductSearchResult.html">AboutYou::SDK::Model::ProductSearchResult</a></p>
</li></ul>
</li></ul>
          
          

          
          <div class="method-source-code" id="create_product_search_result-source">
            <pre><span class="ruby-comment"># File lib/AboutYou/Factory/default_model_factory.rb, line 435</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">create_product_search_result</span>(<span class="ruby-identifier">json_object</span>, <span class="ruby-identifier">_query</span>)
  <span class="ruby-constant">AboutYou</span><span class="ruby-operator">::</span><span class="ruby-constant">SDK</span><span class="ruby-operator">::</span><span class="ruby-constant">Model</span><span class="ruby-operator">::</span><span class="ruby-constant">ProductSearchResult</span>.<span class="ruby-identifier">create_from_json</span>(
    <span class="ruby-identifier">json_object</span>,
    <span class="ruby-keyword">self</span>
  )
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-create_products_ean_result" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">create_products_ean_result</span><span
            class="method-args">(json_object, _query)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>creates a products eanresult model</p>
<ul><li>
<p><strong>Args</strong>    :</p>
<ul><li>
<p><code>json_object</code> -&gt; the api response in json format</p>
</li><li>
<p><code>_query</code> -&gt; the _query sent to the api</p>
</li></ul>
</li><li>
<p><strong>Returns</strong> :</p>
<ul><li>
<p>an instance of AboutYou::SDK::Model::ProductsEanResult</p>
</li></ul>
</li></ul>
          
          

          
          <div class="method-source-code" id="create_products_ean_result-source">
            <pre><span class="ruby-comment"># File lib/AboutYou/Factory/default_model_factory.rb, line 418</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">create_products_ean_result</span>(<span class="ruby-identifier">json_object</span>, <span class="ruby-identifier">_query</span>)
  <span class="ruby-constant">AboutYou</span><span class="ruby-operator">::</span><span class="ruby-constant">SDK</span><span class="ruby-operator">::</span><span class="ruby-constant">Model</span><span class="ruby-operator">::</span><span class="ruby-constant">ProductsEansResult</span>.<span class="ruby-identifier">create_from_json</span>(
    <span class="ruby-identifier">json_object</span>,
    <span class="ruby-keyword">self</span>
  )
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-create_products_result" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">create_products_result</span><span
            class="method-args">(json_object, _query)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>creates a products result model</p>
<ul><li>
<p><strong>Args</strong>    :</p>
<ul><li>
<p><code>json_object</code> -&gt; the api response in json format</p>
</li><li>
<p><code>_query</code> -&gt; the _query sent to the api</p>
</li></ul>
</li><li>
<p><strong>Returns</strong> :</p>
<ul><li>
<p>an instance of <a
href="../Model/ProductsResult.html">AboutYou::SDK::Model::ProductsResult</a></p>
</li></ul>
</li></ul>
          
          

          
          <div class="method-source-code" id="create_products_result-source">
            <pre><span class="ruby-comment"># File lib/AboutYou/Factory/default_model_factory.rb, line 401</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">create_products_result</span>(<span class="ruby-identifier">json_object</span>, <span class="ruby-identifier">_query</span>)
  <span class="ruby-constant">AboutYou</span><span class="ruby-operator">::</span><span class="ruby-constant">SDK</span><span class="ruby-operator">::</span><span class="ruby-constant">Model</span><span class="ruby-operator">::</span><span class="ruby-constant">ProductsResult</span>.<span class="ruby-identifier">create_from_json</span>(
    <span class="ruby-identifier">json_object</span>,
    <span class="ruby-keyword">self</span>
  )
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-create_sale_facet" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">create_sale_facet</span><span
            class="method-args">(json_object)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>this method creates a sale counts model</p>
<ul><li>
<p><strong>Args</strong>    :</p>
<ul><li>
<p><code>json_object</code> -&gt; the api response in json format</p>
</li></ul>
</li><li>
<p><strong>Returns</strong> :</p>
<ul><li>
<p>an instance of <a
href="../Model/SaleCounts.html">AboutYou::SDK::Model::SaleCounts</a></p>
</li></ul>
</li></ul>
          
          

          
          <div class="method-source-code" id="create_sale_facet-source">
            <pre><span class="ruby-comment"># File lib/AboutYou/Factory/default_model_factory.rb, line 621</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">create_sale_facet</span>(<span class="ruby-identifier">json_object</span>)
  <span class="ruby-constant">AboutYou</span><span class="ruby-operator">::</span><span class="ruby-constant">SDK</span><span class="ruby-operator">::</span><span class="ruby-constant">Model</span><span class="ruby-operator">::</span><span class="ruby-constant">SaleCounts</span>.<span class="ruby-identifier">create_from_json</span>(<span class="ruby-identifier">json_object</span>)
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-create_single_product" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">create_single_product</span><span
            class="method-args">(json_object)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>creates a single product model</p>
<ul><li>
<p><strong>Args</strong>    :</p>
<ul><li>
<p><code>json_object</code> -&gt; the api response in json format</p>
</li></ul>
</li><li>
<p><strong>Returns</strong> :</p>
<ul><li>
<p>an instance of <a
href="../Model/Product.html">AboutYou::SDK::Model::Product</a></p>
</li></ul>
</li></ul>
          
          

          
          <div class="method-source-code" id="create_single_product-source">
            <pre><span class="ruby-comment"># File lib/AboutYou/Factory/default_model_factory.rb, line 387</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">create_single_product</span>(<span class="ruby-identifier">json_object</span>)
  <span class="ruby-identifier">createProduct</span>(<span class="ruby-identifier">json_object</span>)
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-create_spell_correction" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">create_spell_correction</span><span
            class="method-args">(json_array, _query)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>creates an spell correction result</p>
<ul><li>
<p><strong>Args</strong>    :</p>
<ul><li>
<p><code>json_array</code> -&gt; the api response in an array</p>
</li></ul>
</li><li>
<p><strong>Returns</strong> :</p>
<ul><li>
<p>an Array containing String</p>
</li></ul>
</li></ul>
          
          

          
          <div class="method-source-code" id="create_spell_correction-source">
            <pre><span class="ruby-comment"># File lib/AboutYou/Factory/default_model_factory.rb, line 565</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">create_spell_correction</span>(<span class="ruby-identifier">json_array</span>, <span class="ruby-identifier">_query</span>)
  <span class="ruby-identifier">json_array</span>
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-create_suggest" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">create_suggest</span><span
            class="method-args">(jsonArray, _query)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>creates an Array containing suggests</p>
<ul><li>
<p><strong>Args</strong>    :</p>
<ul><li>
<p><code>jsonArray</code> -&gt; an Array with the api response</p>
</li><li>
<p><code>_query</code> -&gt; the _query sent to the api</p>
</li></ul>
</li><li>
<p><strong>Returns</strong> :</p>
<ul><li>
<p>an Array containing suggests</p>
</li></ul>
</li></ul>
          
          

          
          <div class="method-source-code" id="create_suggest-source">
            <pre><span class="ruby-comment"># File lib/AboutYou/Factory/default_model_factory.rb, line 470</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">create_suggest</span>(<span class="ruby-identifier">jsonArray</span>, <span class="ruby-identifier">_query</span>)
  <span class="ruby-identifier">jsonArray</span>
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-create_variant" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">create_variant</span><span
            class="method-args">(json_object, product)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>creates a variant model</p>
<ul><li>
<p><strong>Args</strong>    :</p>
<ul><li>
<p><code>json_object</code> -&gt; the api response in json format</p>
</li><li>
<p><code>product</code> -&gt; the product of the variant which should be
created</p>
</li></ul>
</li><li>
<p><strong>Returns</strong> :</p>
<ul><li>
<p>an instance of <a
href="../Model/Variant.html">AboutYou::SDK::Model::Variant</a></p>
</li></ul>
</li></ul>
          
          

          
          <div class="method-source-code" id="create_variant-source">
            <pre><span class="ruby-comment"># File lib/AboutYou/Factory/default_model_factory.rb, line 484</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">create_variant</span>(<span class="ruby-identifier">json_object</span>, <span class="ruby-identifier">product</span>)
  <span class="ruby-constant">AboutYou</span><span class="ruby-operator">::</span><span class="ruby-constant">SDK</span><span class="ruby-operator">::</span><span class="ruby-constant">Model</span><span class="ruby-operator">::</span><span class="ruby-constant">Variant</span>.<span class="ruby-identifier">create_from_json</span>(
    <span class="ruby-identifier">json_object</span>,
    <span class="ruby-keyword">self</span>,
    <span class="ruby-identifier">product</span>
  )
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-create_variants_result" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">create_variants_result</span><span
            class="method-args">(json_object, _query)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>creates a variants result model</p>
<ul><li>
<p><strong>Args</strong>    :</p>
<ul><li>
<p><code>json_object</code> -&gt; the api response in json format</p>
</li><li>
<p><code>_query</code> -&gt; the _query sent to the api</p>
</li></ul>
</li><li>
<p><strong>Returns</strong> :</p>
<ul><li>
<p>an instance of <a
href="../Model/VariantsResult.html">AboutYou::SDK::Model::VariantsResult</a></p>
</li></ul>
</li></ul>
          
          

          
          <div class="method-source-code" id="create_variants_result-source">
            <pre><span class="ruby-comment"># File lib/AboutYou/Factory/default_model_factory.rb, line 334</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">create_variants_result</span>(<span class="ruby-identifier">json_object</span>, <span class="ruby-identifier">_query</span>)
  <span class="ruby-identifier">variants</span> = {}
  <span class="ruby-identifier">errors</span> = []
  <span class="ruby-identifier">product_ids</span> = []
  <span class="ruby-identifier">product_search_result</span> = <span class="ruby-keyword">false</span>

  <span class="ruby-identifier">json_object</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">id</span>, <span class="ruby-identifier">data</span><span class="ruby-operator">|</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">data</span>[<span class="ruby-string">'error_code'</span>]
      <span class="ruby-identifier">errors</span>.<span class="ruby-identifier">push</span>(<span class="ruby-identifier">id</span>)
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">variants</span>[<span class="ruby-identifier">data</span>[<span class="ruby-string">'id'</span>]] = <span class="ruby-identifier">data</span>[<span class="ruby-string">'product_id'</span>]
      <span class="ruby-identifier">product_ids</span>.<span class="ruby-identifier">push</span>(<span class="ruby-identifier">data</span>[<span class="ruby-string">'product_id'</span>])
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-keyword">if</span> <span class="ruby-identifier">product_ids</span>.<span class="ruby-identifier">count</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span>
    <span class="ruby-identifier">product_ids</span> = <span class="ruby-identifier">product_ids</span>.<span class="ruby-identifier">uniq</span>
    <span class="ruby-comment"># search products for valid variants</span>

    <span class="ruby-identifier">product_search_result</span> = <span class="ruby-identifier">shop_api</span>.<span class="ruby-identifier">fetch_products_by_ids</span>(
        <span class="ruby-identifier">product_ids</span>, [
          <span class="ruby-constant">AboutYou</span><span class="ruby-operator">::</span><span class="ruby-constant">SDK</span><span class="ruby-operator">::</span><span class="ruby-constant">Criteria</span><span class="ruby-operator">::</span><span class="ruby-constant">ProductFields</span><span class="ruby-operator">::</span><span class="ruby-constant">ATTRIBUTES_MERGED</span>,
          <span class="ruby-constant">AboutYou</span><span class="ruby-operator">::</span><span class="ruby-constant">SDK</span><span class="ruby-operator">::</span><span class="ruby-constant">Criteria</span><span class="ruby-operator">::</span><span class="ruby-constant">ProductFields</span><span class="ruby-operator">::</span><span class="ruby-constant">BRAND</span>,
          <span class="ruby-constant">AboutYou</span><span class="ruby-operator">::</span><span class="ruby-constant">SDK</span><span class="ruby-operator">::</span><span class="ruby-constant">Criteria</span><span class="ruby-operator">::</span><span class="ruby-constant">ProductFields</span><span class="ruby-operator">::</span><span class="ruby-constant">CATEGORIES</span>,
          <span class="ruby-constant">AboutYou</span><span class="ruby-operator">::</span><span class="ruby-constant">SDK</span><span class="ruby-operator">::</span><span class="ruby-constant">Criteria</span><span class="ruby-operator">::</span><span class="ruby-constant">ProductFields</span><span class="ruby-operator">::</span><span class="ruby-constant">DEFAULT_IMAGE</span>,
          <span class="ruby-constant">AboutYou</span><span class="ruby-operator">::</span><span class="ruby-constant">SDK</span><span class="ruby-operator">::</span><span class="ruby-constant">Criteria</span><span class="ruby-operator">::</span><span class="ruby-constant">ProductFields</span><span class="ruby-operator">::</span><span class="ruby-constant">DEFAULT_VARIANT</span>,
          <span class="ruby-constant">AboutYou</span><span class="ruby-operator">::</span><span class="ruby-constant">SDK</span><span class="ruby-operator">::</span><span class="ruby-constant">Criteria</span><span class="ruby-operator">::</span><span class="ruby-constant">ProductFields</span><span class="ruby-operator">::</span><span class="ruby-constant">DESCRIPTION_LONG</span>,
          <span class="ruby-constant">AboutYou</span><span class="ruby-operator">::</span><span class="ruby-constant">SDK</span><span class="ruby-operator">::</span><span class="ruby-constant">Criteria</span><span class="ruby-operator">::</span><span class="ruby-constant">ProductFields</span><span class="ruby-operator">::</span><span class="ruby-constant">DESCRIPTION_SHORT</span>,
          <span class="ruby-constant">AboutYou</span><span class="ruby-operator">::</span><span class="ruby-constant">SDK</span><span class="ruby-operator">::</span><span class="ruby-constant">Criteria</span><span class="ruby-operator">::</span><span class="ruby-constant">ProductFields</span><span class="ruby-operator">::</span><span class="ruby-constant">IS_ACTIVE</span>,
          <span class="ruby-constant">AboutYou</span><span class="ruby-operator">::</span><span class="ruby-constant">SDK</span><span class="ruby-operator">::</span><span class="ruby-constant">Criteria</span><span class="ruby-operator">::</span><span class="ruby-constant">ProductFields</span><span class="ruby-operator">::</span><span class="ruby-constant">IS_SALE</span>,
          <span class="ruby-constant">AboutYou</span><span class="ruby-operator">::</span><span class="ruby-constant">SDK</span><span class="ruby-operator">::</span><span class="ruby-constant">Criteria</span><span class="ruby-operator">::</span><span class="ruby-constant">ProductFields</span><span class="ruby-operator">::</span><span class="ruby-constant">MAX_PRICE</span>,
          <span class="ruby-constant">AboutYou</span><span class="ruby-operator">::</span><span class="ruby-constant">SDK</span><span class="ruby-operator">::</span><span class="ruby-constant">Criteria</span><span class="ruby-operator">::</span><span class="ruby-constant">ProductFields</span><span class="ruby-operator">::</span><span class="ruby-constant">MIN_PRICE</span>,
          <span class="ruby-constant">AboutYou</span><span class="ruby-operator">::</span><span class="ruby-constant">SDK</span><span class="ruby-operator">::</span><span class="ruby-constant">Criteria</span><span class="ruby-operator">::</span><span class="ruby-constant">ProductFields</span><span class="ruby-operator">::</span><span class="ruby-constant">VARIANTS</span>
        ]
      )
  <span class="ruby-keyword">end</span>

  <span class="ruby-constant">AboutYou</span><span class="ruby-operator">::</span><span class="ruby-constant">SDK</span><span class="ruby-operator">::</span><span class="ruby-constant">Model</span><span class="ruby-operator">::</span><span class="ruby-constant">VariantsResult</span>.<span class="ruby-identifier">create</span>(
    <span class="ruby-identifier">variants</span>,
    <span class="ruby-identifier">errors</span>,
    <span class="ruby-identifier">product_search_result</span>
  )
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-initialize_category_manager" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">initialize_category_manager</span><span
            class="method-args">(json_object)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>this methods initiates the category manager</p>
<ul><li>
<p><strong>Args</strong>    :</p>
<ul><li>
<p><code>json_object</code> -&gt; the api response in json format</p>
</li></ul>
</li></ul>
          
          

          
          <div class="method-source-code" id="initialize_category_manager-source">
            <pre><span class="ruby-comment"># File lib/AboutYou/Factory/default_model_factory.rb, line 575</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize_category_manager</span>(<span class="ruby-identifier">json_object</span>)
  <span class="ruby-identifier">category_manager</span>.<span class="ruby-identifier">parse_json</span>(<span class="ruby-identifier">json_object</span>, <span class="ruby-keyword">self</span>)
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-initialize_managers" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">initialize_managers</span><span
            class="method-args">(facet_manager, category_manager)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>this method initializes the managers</p>
<ul><li>
<p><strong>Args</strong>    :</p>
<ul><li>
<p><code>facet_manager</code> -&gt; the facet manager responsible for managing
the facets</p>
</li><li>
<p><code>category_manager</code> -&gt; the category manager responsible for
managing the categories</p>
</li></ul>
</li></ul>
          
          

          
          <div class="method-source-code" id="initialize_managers-source">
            <pre><span class="ruby-comment"># File lib/AboutYou/Factory/default_model_factory.rb, line 44</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize_managers</span>(<span class="ruby-identifier">facet_manager</span>, <span class="ruby-identifier">category_manager</span>)
  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">category_manager</span> = <span class="ruby-identifier">category_manager</span>
  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">facet_manager</span> = <span class="ruby-identifier">facet_manager</span>
  <span class="ruby-constant">AboutYou</span><span class="ruby-operator">::</span><span class="ruby-constant">SDK</span><span class="ruby-operator">::</span><span class="ruby-constant">Model</span><span class="ruby-operator">::</span><span class="ruby-constant">FacetGroupSet</span>.<span class="ruby-identifier">facet_manager</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">facet_manager</span>
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-initiate_order" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">initiate_order</span><span
            class="method-args">(json_object, _query)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>creates an initiate order model</p>
<ul><li>
<p><strong>Args</strong>    :</p>
<ul><li>
<p><code>json_object</code> -&gt; the api response in json format</p>
</li><li>
<p><code>_query</code> -&gt; the _query sent to the api</p>
</li></ul>
</li><li>
<p><strong>Returns</strong> :</p>
<ul><li>
<p>an instance of <a
href="../Model/InitiateOrder.html">AboutYou::SDK::Model::InitiateOrder</a></p>
</li></ul>
</li></ul>
          
          

          
          <div class="method-source-code" id="initiate_order-source">
            <pre><span class="ruby-comment"># File lib/AboutYou/Factory/default_model_factory.rb, line 518</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initiate_order</span>(<span class="ruby-identifier">json_object</span>, <span class="ruby-identifier">_query</span>)
  <span class="ruby-constant">AboutYou</span><span class="ruby-operator">::</span><span class="ruby-constant">SDK</span><span class="ruby-operator">::</span><span class="ruby-constant">Model</span><span class="ruby-operator">::</span><span class="ruby-constant">InitiateOrder</span>.<span class="ruby-identifier">create_from_json</span>(<span class="ruby-identifier">json_object</span>)
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-pre_handle_error" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">pre_handle_error</span><span
            class="method-args">(json, result_key, is_multi_request)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>this method tries to handle errors which are received from the api</p>
<ul><li>
<p><strong>Args</strong>    :</p>
<ul><li>
<p><code>json</code> -&gt; the api response in json format</p>
</li><li>
<p><code>resultKey</code> -&gt; the result key received from the api</p>
</li><li>
<p><code>isMultiRequest</code> -&gt; determines whether the api-request was
multiquery or not</p>
</li></ul>
</li><li>
<p><strong>Fails</strong> :</p>
<ul><li>
<p>if the result_key is not basket and the json response does not contain
order_lines</p>
</li></ul>
</li></ul>
          
          

          
          <div class="method-source-code" id="pre_handle_error-source">
            <pre><span class="ruby-comment"># File lib/AboutYou/Factory/default_model_factory.rb, line 674</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">pre_handle_error</span>(<span class="ruby-identifier">json</span>, <span class="ruby-identifier">result_key</span>, <span class="ruby-identifier">is_multi_request</span>)
  <span class="ruby-keyword">return</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">result_key</span> <span class="ruby-operator">==</span> <span class="ruby-string">'basket'</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">json</span>[<span class="ruby-string">'order_lines'</span>]

  <span class="ruby-identifier">fail</span> <span class="ruby-string">'ResultError!'</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">json</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">is_multi_request</span>
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-term_facets" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">term_facets</span><span
            class="method-args">(group_id, json_terms)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>creates an Array containing one or multiple instances of <a
href="../Model/FacetCount.html">AboutYou::SDK::Model::FacetCount</a></p>
<ul><li>
<p><strong>Args</strong>    :</p>
<ul><li>
<p><code>group_id</code> -&gt; the group id of the facets</p>
</li><li>
<p><code>jsonTerms</code> -&gt; the single facet terms in json format</p>
</li></ul>
</li><li>
<p><strong>Returns</strong> :</p>
<ul><li>
<p>an Array containing instances of <a
href="../Model/FacetCount.html">AboutYou::SDK::Model::FacetCount</a></p>
</li></ul>
</li></ul>
          
          

          
          <div class="method-source-code" id="term_facets-source">
            <pre><span class="ruby-comment"># File lib/AboutYou/Factory/default_model_factory.rb, line 262</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">term_facets</span>(<span class="ruby-identifier">group_id</span>, <span class="ruby-identifier">json_terms</span>)
  <span class="ruby-identifier">facet_counts</span> = []
  <span class="ruby-identifier">json_terms</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">json_term</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">id</span> = <span class="ruby-constant">Integer</span>(<span class="ruby-identifier">json_term</span>[<span class="ruby-string">'term'</span>])
    <span class="ruby-identifier">facet</span> = <span class="ruby-identifier">facet_manager</span>.<span class="ruby-identifier">facet</span>(<span class="ruby-identifier">group_id</span>, <span class="ruby-identifier">id</span>)
    <span class="ruby-keyword">next</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">facet</span>

    <span class="ruby-comment"># TODO: Handle error, write test</span>
    <span class="ruby-identifier">facet_counts</span>.<span class="ruby-identifier">push</span>(<span class="ruby-constant">AboutYou</span><span class="ruby-operator">::</span><span class="ruby-constant">SDK</span><span class="ruby-operator">::</span><span class="ruby-constant">Model</span><span class="ruby-operator">::</span><span class="ruby-constant">FacetCount</span>.<span class="ruby-identifier">new</span>(
        <span class="ruby-identifier">facet</span>,
        <span class="ruby-identifier">json_term</span>[<span class="ruby-string">'count'</span>]
      )
    )
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">facet_counts</span>
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-update_facet_manager" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">update_facet_manager</span><span
            class="method-args">(json_object, query)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>this methods updates the facet manager</p>
<ul><li>
<p><strong>Args</strong>    :</p>
<ul><li>
<p><code>json_object</code> -&gt; the api response in json format</p>
</li><li>
<p><code>query</code> -&gt; the query sent to the api</p>
</li></ul>
</li></ul>
          
          

          
          <div class="method-source-code" id="update_facet_manager-source">
            <pre><span class="ruby-comment"># File lib/AboutYou/Factory/default_model_factory.rb, line 586</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">update_facet_manager</span>(<span class="ruby-identifier">json_object</span>, <span class="ruby-identifier">query</span>)
  <span class="ruby-identifier">facet_manager</span>.<span class="ruby-identifier">parse_json</span>(<span class="ruby-identifier">json_object</span>, <span class="ruby-keyword">self</span>, <span class="ruby-identifier">query</span>)
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
    </section>
  
  </section>
</main>


<footer id="validator-badges" role="contentinfo">
  <p><a href="http://validator.w3.org/check/referer">Validate</a>
  <p>Generated by <a href="http://rdoc.rubyforge.org">RDoc</a> 4.1.2.
  <p>Based on <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
</footer>

